package com.tom.mybatis.main;

import com.tom.mybatis.bean.Test;
import com.tom.mybatis.config.Configuration;
import com.tom.mybatis.config.mappers.TestMapper;
import com.tom.mybatis.executor.ExecutorFactory;
import com.tom.mybatis.session.SqlSession;

/**
 * @author : tom
 * @project: tom-mybatis
 * @date : 2018/11/7 14:46
 */
public class Main {
    public static void main(String[] args) {
        Configuration configuration = new Configuration();
        configuration.scanPath("com.tom.mybatis.config.mappers");
        configuration.build();

        SqlSession sqlSession = new SqlSession(configuration,
                ExecutorFactory.get(ExecutorFactory.ExecutorType.SIMPLE.name(), configuration));

        TestMapper testMapper = sqlSession.getMapper(TestMapper.class);
        Test test = testMapper.selectByPrimaryKey(1);
        Test test2 = testMapper.selectByPrimaryKey(1);
        System.out.println(test);
    }
}
